<?php

class MyController extends CController
{
	var $sql_folder;
	var $create_data_sql ;
	var $insert_data_sql;
	
	var $conn;
	var $comm;
	
	var $controller_id;
	
	function init()
	{
		$this->sql_folder = INSTALL_FOLDER . "sql";
		$this->controller_id = $this->getId();
	}
	
	function run_sql($file_sql)
	{
		$f = fopen($file_sql,"r");
		if ($f)
		{
			while(!feof($f))
			{
				$sQuery="";
				$c=fgetc($f);
				while ($c!==';' && !feof($f))
				{
					$sQuery .= $c;
					$c=fgetc($f);
				}	
				
				if (strlen($sQuery)>10 && $sQuery !== '﻿')
				{
					$sQuery .=";";
					$this->comm = $this->conn->createCommand($sQuery);
					$this->comm->execute();
				}
			}
			
			fclose($f);
		}
	}
}
